"use strict"

/**
 * 黑龙江省政府采购网爬虫
 *  找不到采购网站
 */

var Base = require("./base");
var hlj_spider = new Base();
hlj_spider.name = "黑龙江省政府采购网";
hlj_spider.page = 1;
hlj_spider.enabled = false;
hlj_spider.contentType = "text";

hlj_spider.getPageUrl = function (pg) {
    return "http://www.hljcg.gov.cn/xwzs!queryXwxxqx.action?xwzsPage.pageNo=2&xwzsPage.pageSize=20&xwzsPage.pageCount=830&lbbh=4&xwzsPage.LBBH=4";
};

hlj_spider.getItems = function (data) {
    var items = [];
    var reg = new RegExp("onclick=\"javascript\:location\.href=\'(.*?)\'\;return false\;>(.*?)<\/a>", "ig");
    var regv;
    while (regv = reg.exec(data)) {
        var url = regv[1];
        var title = regv[2];
        var item = {};
        item.title = title;
        item.url = "http://www.hljcein.com" + url;
        item.source = hlj_spider.name;
        items.push(item);
    }
    return items;
};

exports = module.exports = hlj_spider;